﻿Namespace Yurtdisi
	Module Functions

		Function HizSureAktKayRapor(ByVal Process As Token, ByVal Tarih1 As Date, ByVal tarih2 As Date, ByVal TarihAlani As String, ByVal order_By As String) As Recordset
			Q("select * from ")
			Q(" ssdmerkez..ydhizmet ")
            Q("where " & TarihAlani & " between :d1 and :d2 order by " & order_By)
            Return Process.OpenSQL("*", Tarih1, tarih2)
		End Function

		Function SaglikYardKayRapor(ByVal Process As Token, ByVal Tarih1 As Date, ByVal tarih2 As Date, ByVal TarihAlani As String, ByVal order_By As String) As Recordset
			Q("select * from ")
			Q(" ssdmerkez..ydsaglik ")
            Q("where " & TarihAlani & " between :d1 and :d2 order by " & order_By)
            Return Process.OpenSQL("*", Tarih1, tarih2)
		End Function

        Function EmekliSaglikYardKayRapor(ByVal Process As Token, ByVal Tarih1 As Date, ByVal tarih2 As Date, ByVal Uyruk As String, ByVal Ad As String, ByVal Soyad As String, ByVal order_By As String) As Recordset
            Dim where As String = ""

            where = " where  ilkKayitTarihi between :d1 and :d2  "
            where = where & If(Uyruk = "Hepsi", " ", " and TC_KKTC='" & Uyruk & "' ")
            where = where & If(Ad = "", " ", " and AD like '" & Ad & "%' ")
            where = where & If(Soyad = "", " ", " and SOYAD like '" & Soyad & "%' ")

            Q("select AD, SOYAD,DOSYA_NO , TC_KKTC, DTAR, KKTC_KIMLIK, ilkKayitTarihi, islemtar from ssdmerkez..ydEmekli ")
            Q("" & where)
            Q("order by " & order_By)
            Return Process.OpenSQL("*", Tarih1, tarih2)
        End Function

	End Module
End Namespace
